package com.bruce.codeFactory.practice;

/**
 * @author luotuan
 * @Description threadLocal示例
 * @create 2019-02-18 11:29
 **/
public class ThreadLocalDemo {
    public static void main(String[] args) {
        final ThreadLocal<Integer> local = new ThreadLocal<>();
        local.set(100);
        Thread t = new Thread(new Runnable() {
            @Override
            public void run() {
                System.out.println(Thread.currentThread().getName()+" local:"+local.get());
            }
        });
        t.start();
        System.out.println("Main local: "+local.get());
    }
}
